module.exports = {
  /**
   * get 获取数据
   */
  getData: function (params, cb) {
    var token = wx.getStorageSync("utoken");
    wx.request({
      url: params._url,
      data: params.data,
      method: 'GET',
      header: {
        'content-type': 'application/json;charset=UTF-8',
        'x-client-token':token
      },
      success: function (res) {
        if (res.statusCode == 200) {
          typeof cb === 'function' && cb(res.data)
        }
      },
      fail: function () {
      },
      complete: function () {
      }
    })
  },
  /**
   * post 提交数据
   */
  postData: function (params, cb) {
    var token = wx.getStorageSync("utoken");
    wx.request({
      url: params._url,
      data: params.data,
      method: 'POST',
      header: {
        'content-type': 'application/json;charset=UTF-8',
        'x-client-token': token
      },
      success: function (res) {
        if (res.statusCode == 200) {
          typeof cb === 'function' && cb(res.data)
        }
      },
      fail: function () {
      },
      complete: function () {
      }
    })
  },

}